package cn.iocoder.idata.module.idata.dal.mysql.datalog;

import java.util.*;

import cn.iocoder.idata.framework.common.pojo.PageResult;
import cn.iocoder.idata.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.idata.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.idata.module.idata.dal.dataobject.datalog.DataLogDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.idata.module.idata.controller.admin.datalog.vo.*;

/**
 * 日志 Mapper
 *
 * @author 智数源码
 */
@Mapper
public interface DataLogMapper extends BaseMapperX<DataLogDO> {

    default PageResult<DataLogDO> selectPage(DataLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DataLogDO>()
                .eqIfPresent(DataLogDO::getNumber, reqVO.getNumber())
                .eqIfPresent(DataLogDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(DataLogDO::getIncomeTime, reqVO.getIncomeTime())
                .betweenIfPresent(DataLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DataLogDO::getId));
    }

    default List<DataLogDO> selectList(DataLogExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<DataLogDO>()
                .eqIfPresent(DataLogDO::getNumber, reqVO.getNumber())
                .eqIfPresent(DataLogDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(DataLogDO::getIncomeTime, reqVO.getIncomeTime())
                .betweenIfPresent(DataLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DataLogDO::getId));
    }

}
